<extend name="public:dialog_template" />
<block name="title">添加分类</block>
<block name="before_style">
    <link rel="stylesheet" href="__STATIC__/bootstrap/css/bootstrap.min.css">
</block>

<block name="content">
    <div id="tabContent" class="tab-content">

            <div style="padding-top: 20px; padding-left: 30px;">
                <form class="form-horizontal" role="form" action="{:u('backend/bottle_cate/add')}" method="post">

                    <div class="form-group">
                        <label class="control-label label-form group-horizontal line-30">分类:</label>
                        <div class="input-padding group-horizontal width-250">
                            <input type="text" class="form-control input-sm "  name="name" id="name"
                                   placeholder="请输入分类">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label label-form group-horizontal line-30">排序:</label>
                        <div class="input-padding group-horizontal" style="width: 80px;">
                            <input type="text" class="form-control input-sm" name="ordid" id="ordid"
                                   placeholder="255">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label label-form  group-horizontal line-30">状态:</label>
                        <div class="input-padding group-horizontal">
                            <label class="margin-right-10">
                                <input type="radio" name="status"  value="1" checked="checked"> 是
                            </label>
                            <label class="margin-right-10">
                                <input type="radio" name="status" value="0"> 否
                            </label>
                        </div>
                    </div>


                </form>

            </div>

    </div>
</block>

<block name="script">
    <script>
        function submitEvent()
        {
            var cate_name     = $.trim($('#name').val());
            if(!cate_name)
            {
                $('#name').val('').focus();
                layer.tips('请输入分类', '#name', {
                    tips: [3, '#009f95'],
                    time: 2000
                });
                return false;
            }
            //数据验证
            $.ajax({
                type: "POST",
                url: $('.form-horizontal').attr('action'),
                data: $('.form-horizontal').serialize(),
                dataType: "json",
                success:function(data){
                    if(data.status)
                    {
                        layer.msg(data.msg,{icon: 1,time:2000, shade: [0.1, '#ccc']},function(){
                            window.parent.location.reload();
                        })
                    } else {
                        layer.msg(data.msg,{icon: 2,time:2000, shade: [0.1, '#ccc']})
                    }

                }
            });
            return false;
        }
    </script>
</block>